home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2005 October / PCWOCT05.iso / Software / FromTheMag / The GIMP 2.2.8 / gimp-2.2.8-i586-setup.exe / {app} / share / gimp / 2.0 / scripts / beveled-pattern-bullet.scm < prev    next >
Encoding:
Text File  |  2005-06-30  |  3.1 KB  |  92 lines

  1. ; The GIMP -- an image manipulation program
  2. ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
  3. ;
  4. ; Beveled pattern bullet for web pages
  5. ; Copyright (C) 1997 Federico Mena Quintero
  6. ; federico@nuclecu.unam.mx
  7. ;
  8. ; This program is free software; you can redistribute it and/or modify
  9. ; it under the terms of the GNU General Public License as published by
  10. ; the Free Software Foundation; either version 2 of the License, or
  11. ; (at your option) any later version.
  12. ;
  13. ; This program is distributed in the hope that it will be useful,
  14. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. ; GNU General Public License for more details.
  17. ;
  18. ; You should have received a copy of the GNU General Public License
  19. ; along with this program; if not, write to the Free Software
  20. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  
  22.  
  23. (define (script-fu-beveled-pattern-bullet diameter pattern transparent)
  24.   (let* ((img (car (gimp-image-new diameter diameter RGB)))
  25.      (background (car (gimp-layer-new img diameter diameter RGBA-IMAGE "Bullet" 100 NORMAL-MODE)))
  26.      (bumpmap (car (gimp-layer-new img diameter diameter RGBA-IMAGE "Bumpmap" 100 NORMAL-MODE))))
  27.  
  28.     (gimp-context-push)
  29.  
  30.     (gimp-image-undo-disable img)
  31.     (gimp-image-add-layer img background -1)
  32.     (gimp-image-add-layer img bumpmap -1)
  33.  
  34.     ; Create pattern layer
  35.  
  36.     (gimp-context-set-background '(0 0 0))
  37.     (gimp-edit-fill background BACKGROUND-FILL)
  38.     (gimp-context-set-pattern pattern)
  39.     (gimp-edit-bucket-fill background PATTERN-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0)
  40.  
  41.     ; Create bumpmap layer
  42.  
  43.     (gimp-edit-fill bumpmap BACKGROUND-FILL)
  44.  
  45.     (gimp-context-set-background '(127 127 127))
  46.     (gimp-ellipse-select img 1 1 (- diameter 2) (- diameter 2) CHANNEL-OP-REPLACE TRUE FALSE 0)
  47.     (gimp-edit-fill bumpmap BACKGROUND-FILL)
  48.  
  49.     (gimp-context-set-background '(255 255 255))
  50.     (gimp-ellipse-select img 2 2 (- diameter 4) (- diameter 4) CHANNEL-OP-REPLACE TRUE FALSE 0)
  51.     (gimp-edit-fill bumpmap BACKGROUND-FILL)
  52.  
  53.     (gimp-selection-none img)
  54.  
  55.     ; Bumpmap
  56.  
  57.     (plug-in-bump-map 1 img background bumpmap 135 45 2 0 0 0 0 TRUE FALSE 0)
  58.  
  59.     ; Background
  60.  
  61.     (gimp-context-set-background '(0 0 0))
  62.     (gimp-ellipse-select img 0 0 diameter diameter CHANNEL-OP-REPLACE TRUE FALSE 0)
  63.     (gimp-selection-invert img)
  64.     (gimp-edit-clear background)
  65.     (gimp-selection-none img)
  66.  
  67.     (gimp-image-set-active-layer img background)
  68.     (gimp-image-remove-layer img bumpmap)
  69.  
  70.     (if (= transparent FALSE)
  71.     (gimp-image-flatten img))
  72.  
  73.     (gimp-image-undo-enable img)
  74.     (gimp-display-new img)
  75.  
  76.     (gimp-context-pop)))
  77.  
  78.  
  79. (script-fu-register "script-fu-beveled-pattern-bullet"
  80.             _"_Bullet..."
  81.             "Beveled pattern bullet"
  82.             "Federico Mena Quintero"
  83.             "Federico Mena Quintero"
  84.             "July 1997"
  85.             ""
  86.             SF-ADJUSTMENT _"Diameter"               '(16 1 150 1 10 0 1)
  87.             SF-PATTERN    _"Pattern"                "Wood"
  88.             SF-TOGGLE     _"Transparent background" FALSE)
  89.  
  90. (script-fu-menu-register "script-fu-beveled-pattern-bullet"
  91.              _"<Toolbox>/Xtns/Script-Fu/Web Page Themes/Beveled Pattern")
  92.